#include "InCommentC.h"

InCommentC::InCommentC(Scope* pParentScope)
{
    m_eType=Scope::eScopeCommentC;
    m_pxParent = pParentScope;
    m_sScopeEnder = "*/";
	m_cLookAhead = '\0';
}

InCommentC::~InCommentC(void)
{
}

Scope* InCommentC::parse(Token& inToken, bool &bIsEndOfScope)
{
    bIsEndOfScope=false;
	if(inToken.m_sValue == m_sScopeEnder)
    {
		bIsEndOfScope= true;
		m_cLookAhead = '\0';
		m_axBody.push_back(inToken);
		return NULL;
    }

	// Hack for .*/ needed! Tokenizer will return .* and /
	if(inToken.m_bIsDelimiter)
	{
		int nLength = inToken.m_sValue.length();
		if(nLength >1)
		{
			if(inToken.m_sValue[nLength-1]=='*') //Needs to be m_sScopeEnder[last] actually
				m_cLookAhead = '*';
		}
		else
		{
			if(m_cLookAhead == '*') //Needs to be m_sScopeEnder[last] actually
			{
				if(inToken.m_sValue == "/")
				{
					m_cLookAhead = '\0';
					bIsEndOfScope = true;
				}
			}
		}
	}
	
	m_axBody.push_back(inToken);
    return NULL;
}